home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
minix
/
up1510b.tgz
/
up1510b
/
doc
/
indent.doc
< prev
next >
Wrap
Text File
|
1990-07-19
|
14KB
|
415 lines
10 14325: 14 Sep 89 Robert R. Hall indent.doc
(Message # 10: 14325 bytes)
Received: from star.cs.vu.nl by top.cs.vu.nl id aa06624; 14 Sep 89 18:32 MET DST
Received: from hp4nl.nluug.nl by star.cs.vu.nl id aa17761;
14 Sep 89 18:32 MET DST
Received: from [128.49.16.5] by hp4nl.nluug.nl with SMTP
id AA14859 (5.58.1.14/2.14); Thu, 14 Sep 89 18:21:05 MET
Received: by cod.nosc.mil (5.59/1.27)
id AA09086; Thu, 14 Sep 89 09:19:44 PDT
Date: Thu, 14 Sep 89 09:19:44 PDT
From: "Robert R. Hall" <hall@cod.nosc.mil>
Message-Id: <8909141619.AA09086@cod.nosc.mil>
To: ast@cs.vu.nl
Subject: indent.doc
-------
INDENT(1) UNIX Programmer's Manual INDENT(1)
NAME
indent - indent and format C program source
SYNOPSIS
indent [ _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e [ _✓o_✓u_✓t_✓p_✓u_✓t-_✓f_✓i_✓l_✓e ] ] [ -bad | -nbad ]
[ -bap | -nbap ] [ -bbb | -nbbb ] [ -bc | -nbc ]
[ -bl | -br ] [ -c_✓n ] [ -cd_✓n ] [ -cdb | -ncdb ]
[ -ce | -nce ] [ -ci_✓n ] [ -cli_✓n ] [ -d_✓n ] [ -di_✓n ]
[ -dj | -ndj ] [ -ei | -nei ] [ -fc1 | -nfc1 ]
[ -i_✓n ] [ -ip | -nip ] [ -l_✓n ] [ -lc_✓n ]
[ -lp | -nlp ] [ -npro ] [ -pcs | -npcs ]
[ -ps | -nps ] [ -psl | -npsl ] [ -sc | -nsc ]
[ -sob | -nsob ] [ -st ] [ -troff ] [ -v | -nv ]
DESCRIPTION
_✓I_✓n_✓d_✓e_✓n_✓t is a C program formatter. It reformats the C program
in the _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e according to the switches. The switches
which can be specified are described below. They may appear
before or after the file names.
NOTE: If you only specify an _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e, the formatting is
done `in-place', that is, the formatted file is written back
into _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e and a backup copy of _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e is written
in the current directory. If _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e is named
`/blah/blah/file', the backup file is named file._✓B_✓A_✓K.
If _✓o_✓u_✓t_✓p_✓u_✓t-_✓f_✓i_✓l_✓e is specified, _✓i_✓n_✓d_✓e_✓n_✓t checks to make sure it
is different from _✓i_✓n_✓p_✓u_✓t-_✓f_✓i_✓l_✓e.
OPTIONS
The options listed below control the formatting style
imposed by _✓i_✓n_✓d_✓e_✓n_✓t.
-bad,-nbad If -bad is specified, a blank line is forced
after every block of declarations. Default:
-nbad.
-bap,-nbap If -bap is specified, a blank line is forced
after every procedure body. Default: -nbap.
-bbb,-nbbb If -bbb is specified, a blank line is forced
before every block comment. Default: -nbbb.
-bc,-nbc If -bc is specified, then a newline is forced
after each comma in a declaration. -nbc turns
off this option. The default is -nbc.
-br,-bl Specifying -bl lines up compound statements
like this:
if (...)
{
code
Printed 11/1/86 September 10, 1985 1
INDENT(1) UNIX Programmer's Manual INDENT(1)
}
Specifying -br (the default) makes them look
like this:
if (...) {
code
}
-c_✓n The column in which comments on code start.
The default is 33.
-cd_✓n The column in which comments on declarations
start. The default is for these comments to
start in the same column as those on code.
-cdb,-ncdb Enables (disables) the placement of comment
delimiters on blank lines. With this option
enabled, comments look like this:
/*
* this is a comment
*/
Rather than like this:
/* this is a comment */
This only affects block comments, not com-
ments to the right of code. The default is
-cdb.
-ce,-nce Enables (disables) forcing `else's to cuddle
up to the immediately preceding `}'. The
default is -ce.
-ci_✓n Sets the continuation indent to be _✓n. Con-
tinuation lines will be indented that far
from the beginning of the first line of the
statement. Parenthesized expressions have
extra indentation added to indicate the nest-
ing, unless -lp is in effect. -ci defaults
to the same value as -i.
-cli_✓n Causes case labels to be indented _✓n tab stops
to the right of the containing switch state-
ment. -cli0.5 causes case labels to be
indented half a tab stop. The default is
-cli0. (This is the only option that takes a
fractional argument.)
-d_✓n Controls the placement of comments which are
not to the right of code. Specifying -d1
means that such comments are placed one
indentation level to the left of code. The
default -d0 lines up these comments with the
code. See the section on comment indentation
below.
Printed 11/1/86 September 10, 1985 2
INDENT(1) UNIX Programmer's Manual INDENT(1)
-di_✓n Specifies the indentation, in character posi-
tions, from a declaration keyword to the fol-
lowing identifier. The default is -di16.
-dj,-ndj -dj left justifies declarations. -ndj
indents declarations the same as code. The
default is -ndj.
-ei,-nei Enables (disables) special else-if process-
ing. If enabled, ifs following elses will
have the same indentation as the preceding if
statement. The default is -ei.
-fc1,-nfc1 Enables (disables) the formatting of comments
that start in column 1. Often, comments
whose leading `/' is in column 1 have been
carefully hand formatted by the programmer.
In such cases, -nfc1 should be used. The
default is -fc1.
-i_✓n The number of spaces for one indentation
level. The default is 8.
-ip,-nip Enables (disables) the indentation of parame-
ter declarations from the left margin. The
default is -ip.
-l_✓n Maximum length of an output line. The
default is 78.
-lp,-nlp Lines up code surrounded by parenthesis in
continuation lines. If a line has a left
paren which is not closed on that line, then
continuation lines will be lined up to start
at the character position just after the left
paren. For example, here is how a piece of
continued code looks with -nlp in effect:
p1 = first_procedure(second_procedure(p2, p3),
third_procedure(p4, p5));
With -lp in effect (the default) the code
looks somewhat clearer:
p1 = first_procedure(second_procedure(p2, p3),
third_procedure(p4, p5));
Inserting two more newlines we get:
p1 = first_procedure(second_procedure(p2,
p3),
third_procedure(p4,